/*
 * 用户信息处理:修改头像、密码、个人信息
 */
const express = require("express");
const userInfoHandle = require("../router_handle/userInfo");
// 导入数据合法性验证的中间件
const expressJoi = require("@escook/express-joi");
// 导入校验对象
const {
    update_userinfo_schema,
    update_password_schema,
    update_headpic_schema,
} = require("../schema/user");

const router = express.Router();
// 获取用户信息
router.get("/getUserMess", userInfoHandle.getUser);
// 修改用户信息
router.post(
    "/updateUserMess",
    expressJoi(update_userinfo_schema),
    userInfoHandle.updateUser
);
// 修改密码
router.post(
    "/updatePwd",
    expressJoi(update_password_schema),
    userInfoHandle.updatePwd
);
// 修改头像
router.post(
    "/updateHeadPic",
    expressJoi(update_headpic_schema),
    userInfoHandle.updateHeadPic
);
module.exports = router;